#include<stdio.h>
#include<unistd.h>

int gobal_val = 10;

int main(){
  pid_t id = fork();

  int cnt = 0;
  while(1){

   if(id == 0){
    //child
    printf("child:pid = %d, ppid = %d, gobal_val = %d, &gobal_val = %p\n",getpid(),getppid(),gobal_val,&gobal_val);
    sleep(1);
    cnt++;
    if(cnt==5){
      gobal_val=20;
      printf("Attention! now chiled change gobal_val\n");
      printf("-------------------------------------------\n");
    }
   }

   else{
    //father
    printf("father:pid = %d, ppid = %d, gobal_val = %d, &gobal_val = %p\n",getpid(),getppid(),gobal_val,&gobal_val);
    sleep(2);
   }
  }
 return 0;
}
